<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>注册账户 - 家庭记账本</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <div class="container-fluid d-flex align-items-center justify-content-center" style="height: 100vh;">
        <div class="card p-4 shadow" style="min-width: 320px;">
            <h2 class="mb-4 text-center">注册账户</h2>
            <form action="register" method="post">
                <div class="mb-3">
                    <input type="text" class="form-control" name="username" placeholder="用户名" required>
                </div>
                <div class="mb-3">
                    <input type="password" class="form-control" name="password" placeholder="密码" required>
                </div>
                <div class="mb-3">
                    <input type="text" class="form-control" name="name" placeholder="姓名" required>
                </div>
                <div class="mb-3">
                    <input type="email" class="form-control" name="email" placeholder="邮箱" required>
                </div>
                <button type="submit" class="btn btn-success w-100">注册</button>
            </form>
            <div class="mt-3 text-center">
                <a href="index.jsp">返回登录</a>
            </div>
        </div>
    </div>
</body>
<% if (request.getAttribute("error") != null) { %>
<script>
    alert('注册失败：<%= request.getAttribute("error") %>');
</script>
<% } %>
</html> 